package com.js.service.impl;

import com.js.mapper.StudentMapper;
import com.js.pojo.Student;
import com.js.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Transactional
@Service("StudentServiceImpl")
public class StudentServiceImpl implements StudentService {
    private StudentMapper studentMapper;
    @Autowired
    public void setStudentMapper(StudentMapper studentMapper) {
        this.studentMapper = studentMapper;
    }


    @Override
    public int addStudent(Student student) {
        return studentMapper.addStudent(student);
    }

    @Override
    public int deleteStudentById(int id) {
        return studentMapper.deleteStudentById(id);
    }

    @Override
    public int updateStudent(Student student) {
        return studentMapper.updateStudent(student);
    }

    @Override
    public Student queryStudentById(int id) {
        return studentMapper.queryStudentById(id);
    }

    @Override
    public Student queryStudentByAccount(String account) {
        return studentMapper.queryStudentByAccount(account);
    }

    @Override
    public List<Student> queryAllStudent() {
        return studentMapper.queryAllStudent();
    }

    @Override
    public List<Student> queryStudentByName(String StudentName) {
        return studentMapper.queryStudentByName(StudentName);
    }
}
